package com.banyuan;

import com.banyuan.Utils.JDBCUtils;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.Date;

public class JDBCUpdate1 {


    public static void main(String[] args) {
        PreparedStatement pstm = null;
        Connection conn = null;
        try {
            conn = JDBCUtils.getConnection();
            pstm = conn.prepareStatement("delete from person where id = ?");
            pstm.setObject(1,2);
            int i = pstm.executeUpdate();
            System.out.println("影响了" + i + "条数据");


        } catch (SQLException throwables) {
            throwables.printStackTrace();
        } finally {
            JDBCUtils.close(pstm);
            JDBCUtils.close(conn);
        }


    }


}
